package cn.whpu.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.UnsupportedEncodingException;

/**
 *
 */
@Controller
@RequestMapping("/anno")
public class AnnoController {
    @RequestMapping("/testRequestParam")
    public String testRequestParam(@RequestParam String username) throws UnsupportedEncodingException {
        System.out.println("执行");
        username =new String(username.getBytes("ISO-8859-1"), "utf-8");
        System.out.println(username);
        return "success";
    }


    @RequestMapping("/testRequestBody")
    public String testRequestBody(@RequestBody String body)  {
        System.out.println("执行");
        //body =new String(body.getBytes("ISO-8859-1"), "utf-8");
        System.out.println(body);
        return "success";
    }
}
